<?php

namespace Biz\model\brandDecoration;

use Doraemon\pockets\datebase\BaseDbModel;

class BrandCard extends BaseDbModel
{

    const _CONFIG_FILE_ = 'db_store';

    const _CONFIG_SELECT_ = 'db_store';

    const _DATABASE_ = 'hhz_store';

    const _TABLE_NAME = 'brand_card';

    const CARD_STATUS_NORMAL = 1;
    const CARD_STATUS_DELETE = 9;
    const CARD_STATUS = [
        self::CARD_STATUS_NORMAL => '正常',
        self::CARD_STATUS_DELETE => '删除'
    ];

    const CARD_TYPE_BANNER = 1;//轮播banner
    const CARD_TYPE_A = 2;//卡片A
    const CARD_TYPE_B = 3;//卡片B
    const CARD_TYPE_C = 4;//卡片C
    const CARD_TYPE_VIDEO = 5;//视频模块

    //根据brand_id获取品牌装修卡片
    public static function getBrandCards($brand_id)
    {
        return self::select('*', [
            'brand_id' => $brand_id,
            'card_status' => self::CARD_STATUS_NORMAL,
            'ORDER' => [
                'card_sort' => 'ASC'
            ]
        ]);
    }

    public static function getCardById($id)
    {
        return self::get('*', [
            'id' => $id,
            'status' => self::CARD_STATUS_NORMAL
        ]);
    }

    //添加
    public static function addData($data)
    {
        self::insert($data);
        return self::id();
    }

    //修改
    public static function editData($data, $where = [])
    {
        return self::update($data, $where);
    }


}

